﻿CREATE PROCEDURE [dbo].[Address_Insert]

@CreatedBy uniqueidentifier
, @ModifiedBy uniqueidentifier
, @ProvinceID uniqueidentifier
, @Line1 varchar (64)
, @Line2 varchar (64)
, @Suburb varchar (64)
, @Code varchar (12)
, @Longitude numeric (18,18)
, @Latitude numeric (18,18)
AS
BEGIN
SET NOCOUNT ON

DECLARE @CreatedDate datetime
DECLARE @ModifiedDate datetime
DECLARE @Deleted bit
DECLARE @AddressID uniqueidentifier
SET @CreatedDate = GETDATE()
SET @ModifiedDate = GETDATE()
SET @Deleted = 0
SET @AddressID = NEWID()

INSERT INTO [dbo].[Address] ([AddressID]
, [CreatedDate]
, [CreatedBy]
, [ModifiedDate]
, [ModifiedBy]
, [Deleted]
, [ProvinceID]
, [Line1]
, [Line2]
, [Suburb]
, [Code]
, [Longitude]
, [Latitude]
)
VALUES (@AddressID
, @CreatedDate
, @CreatedBy
, @ModifiedDate
, @ModifiedBy
, @Deleted
, @ProvinceID
, @Line1
, @Line2
, @Suburb
, @Code
, @Longitude
, @Latitude
)

SELECT @AddressID [AddressID]
END
